package com.ssm.dao;

import com.ssm.pojo.ProductPojo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface ProductMapper {
    //添加商品
    int addProduct(ProductPojo productPojo);
    //根据id删除商品
    int deleteProduct(@Param("pid") String pid);
    //根据id更新商品
    int updateProduct(ProductPojo productPojo);
    //根据id查询商品
    ProductPojo selectProductById(@Param("pid")String pid);
    //查询所有商品List
    List<ProductPojo> selectAllProduct();
    //查询所有商品数量
    int selectAllProductCount();
    //分页查询
    List<ProductPojo> selectAllProductLimit(@Param("beginRow")int beginRow,@Param("rows")int rows);
    //筛选，去重查询
    @Select("select distinct pid from product")
    List<String> selectDistinctPid();

    @Select("select distinct pname from product")
    List<String> selectDistinctPname();

    @Select("select distinct market_price from product")
    List<String> selectDistinctMarketPrice();

    @Select("select distinct shop_price from product")
    List<String> selectDistinctPrice();

    @Select("select distinct pdate from product")
    List<String> selectDistinctPdate();

    @Select("select distinct is_hot from product")
    List<String> selectDistinctIsHot();

    @Select("select distinct pflag from product")
    List<String> selectDistinctFlag();

    @Select("select distinct cid from product")
    List<String> selectDistinctCid();

    //根据select选中的options进行查询
    List<ProductPojo> selectForm(@Param("strMap")HashMap<String,String> strMap);

    List<ProductPojo> selectForm2(@Param("map") Map<String,String> map);
}
